package com.host.dyyl;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.bigkoo.convenientbanner.ConvenientBanner;
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator;
import com.bigkoo.convenientbanner.listener.OnItemClickListener;
import com.host.dyyl.view.ResourceImageHolderView;

import java.util.ArrayList;
import java.util.List;

/**
 * @author
 * @describe
 * @fileName BannerActivity
 * @date 2018/1/8 17:22
 */

public class BannerActivity extends Activity {

    private ConvenientBanner content_cb;
    private TextView next_tv;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_banner);
        initWidget();
    }

    private void initWidget() {
        List<Integer> imageIdList = new ArrayList<>();
//        imageIdList.add(R.mipmap.welcome1);
//        imageIdList.add(R.mipmap.welcome2);
//        imageIdList.add(R.mipmap.welcome3);
        content_cb = findViewById(R.id.content_cb);
        content_cb.setCanLoop(false);
        content_cb.setPages(new CBViewHolderCreator() {
            @Override
            public Object createHolder() {
                return new ResourceImageHolderView();
            }
        }, imageIdList)
                .setPageIndicator(new int[]{R.mipmap.ic_page_indicator, R.mipmap.ic_page_indicator_focused})
                .setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(int position) {
                    }
                });

        next_tv = findViewById(R.id.next_tv);
        next_tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(BannerActivity.this, MainActivity3.class));
                finish();
            }
        });
    }

}
